﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Core;
using BrokerBase.Lib.Company;
using BrokerBase.Lib.Base;

namespace BrokerBase.Lib.Product
{



    /// <summary>
    /// 保险类别
    /// 主险，附加险
    /// </summary>
    public enum ProductType { Basic = 1, Extra = 2 }
    /// <summary>
    /// 费率类别
    /// 保费，保额
    /// </summary>
    public enum RateType {Premium = 0,Amount =1 }
    /// <summary>
    /// 保额类型
    /// 金额，份数
    /// </summary>
    public enum UnitType { Amt = 0, Qty = 1 }
    /// <summary>
    /// 保险产品
    /// </summary>
    public interface IProduct:IPKItem,ICheck
    {
        string SimpleName { get; }
        /// <summary>
        /// 所属公司
        /// </summary>
        ICompany Company { get; set; }
        /// <summary>
        /// 产品类型
        /// </summary>
        ProductType ProductType { get; }
        /// <summary>
        /// 分类
        /// </summary>
        string Catalog { get; set; }
        /// <summary>
        /// 时间单位
        /// </summary>
        ITimeUnit TimeUnit { get; set; }
        /// <summary>
        /// 计量单位
        /// </summary>
        UnitType UnitType { get; set; }
        /// <summary>
        /// 基本保额
        /// </summary>
        IList<IBasicAmount> BasicAmounts { get; set; }
        /// <summary>
        /// 基本保额来自于固定费率
        /// </summary>
        bool IsBasicAmountsFromFixRate { get; set; }
        /// <summary>
        /// 付款期
        /// </summary>
        IList<IPaymentPeriod> PaymentPeriods { get; set; }
        /// <summary>
        /// 付款期来至于固定费率
        /// </summary>
        bool IsPaymentPeriodsFromFixRate { get; set; }
        /// <summary>
        /// 保障期
        /// </summary>
        IList<IInsurancePeriod> InsurancePeriods { get; set; }
        /// <summary>
        /// 保障期来至于固定费率
        /// </summary>
        bool IsInsurancePeriodsFromFixRate { get; set; }
        /// <summary>
        /// 是否是1年期的保险
        /// 满足一下条件：付款期限等于1年，并且保险期限等于付款期限
        /// </summary>
        bool CanOverPeriod { get; }

        bool CanSetOverPeriod { get; }
        /// <summary>
        /// 付款方式
        /// </summary>
        IList<ITimeUnit> PaymentCycles { get; set; }
        /// <summary>
        /// 列费率因子
        /// </summary>
        IList<IRateFactor> ColRateFactors { get; set; }
        /// <summary>
        /// 行费率因子
        /// </summary>
        IList<IRateFactor> RowRateFactors { get; set; }
        /// <summary>
        /// 是否是阶梯保额
        /// </summary>
        bool IsLadderAmount { get; }
        /// <summary>
        /// 费率对应的类型(保费，保额)
        /// </summary>
        RateType RateType { get; set; }
        /// <summary>
        /// 费率最大列
        /// </summary>
        int MaxRateCol { get; set; }
        /// <summary>
        /// 费率最大行
        /// </summary>
        int MaxRateRow { get; set; }
        /// <summary>
        /// 费率数据行
        /// </summary>
        IList<IRateRow> RateRows { get; set; }

        /// <summary>
        /// 调整费率
        /// </summary>
        IList<IAdjustRate> AdjustRates { get; set; }
        /// <summary>
        /// 辅助属性
        /// </summary>
        IList<IAuxProperty> AuxProperties { get; set; }
        /// <summary>
        /// 保险责任
        /// </summary>
        IList<IDuty> Duties { get; set; }
        /// <summary>
        /// 扩展表达式
        /// </summary>
        IExpandExpress ExpandExpress { get; set; }

        IProductExpander Expander { get; }
        /// <summary>
        /// 主/附险关联
        /// </summary>
        IList<IRelation> Relations { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<string> GetColRateKeys();

        /// <summary>
        /// 费率因子转化到产品属性
        /// </summary>
        //void RateFactorConvert();
        /// <summary>
        /// 被保人状态
        /// </summary>
        IList<string> InsurantStates { get; }
        /// <summary>
        /// 投保人状态
        /// </summary>
        IList<string> HolderStates { get; }
        /// <summary>
        /// 是否编译
        /// </summary>
        bool IsCompiled { get; set; }
        /// <summary>
        /// 编译
        /// </summary>
        void Compile();

        int? MaxPayAge { get; }
    }
}
